DEF_PROJECT=../../..
include $(DEF_PROJECT)/scripts/main.mk
name=gcc
dist=newlib
version=4.7.2
build=gcc-build
group=tools
deps=linux-header mpfr gmp ppl cloog-ppl binutils
prefix=$(DIR_TOOLS)

DL_SERV=http
DL_HOST=ftp.gnu.org
DL_PATH=gnu/$(name)/$(name)-$(version)
DL_SUFFIX=tar.bz2

cdefs+=AR=ar

CC_CFLAGS=-O2
CC_LDFLAGS=
LDFLAGS=-Wl,-rpath,$(prefix)/lib

cflags+=--host=$(CC_HOST)
cflags+=--build=$(CC_BUILD)
cflags+=--target=$(CC_TARGET)
cflags+=--with-sysroot=$(DIR_SYSROOT)
cflags+=--disable-multilib
cflags+=--disable-nls
cflags+=--without-headers
cflags+=--with-newlib
cflags+=--disable-decimal-float
cflags+=--disable-libgomp
cflags+=--disable-libmudflap
cflags+=--disable-libssp
cflags+=--with-mpfr=$(prefix)
cflags+=--with-gmp=$(prefix)
cflags+=--with-ppl=$(prefix)
cflags+=--with-cloog=$(prefix)
#cflags+=--with-cloog-include=$(prefix)/include
#cflags+=--with-cloog-lib=$(prefix)/lib
cflags+=--disable-shared
cflags+=--disable-threads
cflags+=--enable-languages=c

mflags+=all-gcc all-target-libgcc

iflags=install-gcc install-target-libgcc

pre-build:post-source

post-source:$(source)
	sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' $(source)/gcc/configure

post-build:
	$(MAKE) -C$(if $(build),$(build),$(source)) $(iflags)
	cd $(prefix)/lib/gcc/$(CC_TARGET)/$(version) && ln -sf libgcc.a libgcc_eh.a
